package com.boonya.lab.rpc.config;

import com.boonya.lab.gprc.core.GrpcServiceManager;
import com.boonya.protobuf.grpc.SimpleGrpc;
import com.boonya.protobuf.grpc.WebSiteGrpc;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class GrpcStubConfig {

    @Bean("simpleBlockingStub")
    public SimpleGrpc.SimpleBlockingStub simpleBlockingStub() {
        return SimpleGrpc.newBlockingStub(GrpcServiceManager.getChannel("localhost", 8079));
    }

    @Bean("webSiteBlockingStub")
    public WebSiteGrpc.WebSiteBlockingStub webSiteBlockingStub() {
        return WebSiteGrpc.newBlockingStub(GrpcServiceManager.getChannel("localhost", 8079));
    }
}
